package cn.aulang.study.ai.server.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.stereotype.Service;

/**
 * 天气服务
 *
 * @author Aulang
 */
@Slf4j
@Service
public class WeatherService {

    @Tool(description = "获取城市天气预报")
    public String getWeatherForecast(@ToolParam(description = "城市") String city) {
        log.info("开始获取城市天气预报");
        String result = "多云转暴雨，29-36℃，西北风4-6级";
        log.info("获取城市天气预报结果：{}", result);
        return result;
    }

    @Tool(description = "获取城市天气预警")
    public String getWeatherAlerts(@ToolParam(description = "城市") String city) {
        log.info("开始获取城市天气预警");
        String result = "暴雨橙色预警";
        log.info("获取城市天气预警结果：{}", result);
        return result;
    }

    @Tool(description = "获取家里天气预报和预警")
    public String getHomeWeatherForecastAndAlerts() {
        log.info("开始获取家里天气预报和预警");
        String result = "多云转暴雨，29-36℃，西北风4-6级，有暴雨橙色预警";
        log.info("获取家里天气预报和预警结果：{}", result);
        return result;
    }
}
